(() => {
  // 函数语句
  function add(x: number, y: number): number {
    return x + y
  }
  
  // 函数表达式
  let myAdd = function(x: number, y: number): number { 
    return x + y
  }
  // myAdd = 3 // error

  let myAdd2: (x: number, y: number) => number = function(x: number, y: number): number {
    return x + y
  }

  function fn(b: string, a?: number, ) {
  }

  fn('abc')
  fn('abc', 123)
  function fn2(a=3) {
    console.log(a)
  }

  fn2()
  fn2(5)
  // fn2('5') // error

  function fn3(a:string, ...args: number[]) {
    
  }
  fn3('abc')
  fn3('abc', 2, 4)
})()